﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>出差请假</title>
    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="/JqueryPlug/zTree_v3/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
    <link href="/CSS/font-awesome-4.3.0/css/font-awesome.css?v=4.3.0" rel="stylesheet">
    <link href="/CSS/V3/animate.css" rel="stylesheet">
    <link href="/CSS/V3/style.css?v=2.2.0" rel="stylesheet">
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/CSS/bootstrap3.3.5/js/bootstrap.js"></script>
    <script src="/JqueryPlug/laypage/laypage.js"></script>
    <script src="/Scripts/avalon.js"></script>
    <script src="/Scripts/jquery-migrate-1.1.0.min.js"></script>
    <script src="/Scripts/SZHLCommon.js?jsver=5"></script>
    <script src="/JqueryPlug/zTree_v3/js/jquery.ztree.core-3.5.js"></script>
    <script src="/JqueryPlug/zTree_v3/js/jquery.ztree.excheck-3.5.min.js"></script>
    <script>
        var zNodes = null;
        var zTreeObj = null;
        var model = avalon.define({
            $id: "APP_CCXJ",
            menutype: "-1",
            index: ComFunJS.getQueryString("index") ? ComFunJS.getQueryString("index") : 1,
            queryuser: ComFunJS.getnowuser(),
            fnqueryuser: function (item) {
                if (item) {
                    model.queryuser = item; //item.UserName;
                    model.CommonData.clear();
                    model.page = 0;
                    model.GetCCDataList();
                }

            },
            addCCQJ: function () {
                parent.ComFunJS.winviewform("/ViewV3/APPBaseView/APP_ADD_WF.html?FormCode=CCXJ&type=出差请假&PDID=1&lctype=0", "出差请假", "1000", "");
            },
            curCCType: "",
            selCCType: "",
            CCTypeData: [],
            CommonData: [],
            SearchContent: "",
            selContent: "",
            GetCCDataList: function () {
                $.getJSON('/API/FTAPI.ashx?Action=GETMYCCQJLIST_PAGE', { P1: model.curCCType, p: 1, P2: model.SearchContent, b: model.menutype, QUSER: model.queryuser }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        model.CommonData.clear();
                        model.CommonData = resultData.Result;
                        model.selCCType = model.curCCType;
                        model.selContent = model.SearchContent;
                        laypage({
                            cont: 'pageDiv', //容器。值支持id名、原生dom对象，jquery对象。
                            pages: Math.ceil(parseInt(resultData.Result1) * 1.0 / 8), //通过后台拿到的总页数
                            curr: 1, //初始化当前页
                            jump: function (e) { //触发分页后的回调
                                if (model.selCCType != model.curCCType || model.selContent != model.SearchContent) {
                                    e.curr = 1;
                                }
                                $.getJSON('/API/FTAPI.ashx?Action=GETMYCCQJLIST_PAGE', { P1: model.curCCType, p: e.curr, P2: model.SearchContent, b: model.menutype, QUSER: model.queryuser }, function (resultData) {
                                    model.CommonData.clear();
                                    model.CommonData = resultData.Result;
                                    model.selCCType = model.curCCType;
                                    model.selContent = model.SearchContent;
                                })
                            }
                        });
                    }
                })

            },
            LB: function () {
                model.curCCType = $(this).attr("vl");
                model.GetCCDataList()
            }, IsShowTR: false,
            getMenu: function () {
                var setting = {
                    data: {
                        simpleData: {
                            enable: true,
                            idKey: "id",
                            pIdKey: "pId",
                            rootPId: 0
                        }
                    },
                    view: {
                        showLine: false
                    },
                    callback: {
                        onClick: model.zTreeOnClick
                    }
                };
                $.ajax({
                    type: "GET",
                    url: "/API/SZHLAPI.ashx",
                    dataType: "html",
                    data: { "Action": "GETALLBMUSERLIST" },
                    success: function (msg) {
                        if (JSON.parse(msg).Result) {
                            model.IsShowTR = true;
                        }
                        zTreeObj = $.fn.zTree.init($("#tree"), setting, eval(JSON.parse(msg).Result));
                    }
                });
            },
            zTreeOnClick: function (event, treeId, treeNode) {
                model.queryuser = "";
                model.CommonData.clear();
                model.page = 0;
                if (treeNode.isUser) {
                    model.queryuser = treeNode.id;
                } else {
                    model.menutype = treeNode.id;
                    if (treeNode.children.length > 0 && treeNode.children[0].isUser) {

                        $(treeNode.children).each(function (i, user) {
                            model.queryuser += user.id + ",";
                        })
                        model.queryuser = model.queryuser.substring(0, model.queryuser.length - 1);
                    }
                }
                model.GetCCDataList();
            }
        });
        avalon.ready(function () {
            ComFunJS.initsetajax();
            //获取主要菜单
            $.getJSON('/API/FTAPI.ashx?Action=GETCOLUMNLIST', { P1: 3 }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    model.CCTypeData = resultData.Result;
                    model.GetCCDataList();

                }
            })
            model.getMenu();
        })

        function ViewForm(ID, PIID) {
            parent.ComFunJS.winviewform("/ViewV3/APPBaseView/APP_ADD_WF.html?FormCode=CCXJ&pageType=view&ID=" + ID + "&PIID=" + PIID, "出差请假", "1000", "");
        }
    </script>
</head>
<body class="gray-bg" ms-controller="APP_CCXJ">
    <div class="wrapper wrapper-content  animated fadeInRight">
        <div class="row">
            <div class="col-sm-3">
                <div class="ibox float-e-margins">
                    <div class="ibox-content" style="border: 0; border-right: 1px solid #e7eaec;">
                        <div class="file-manager">
                            <div class="hr-line-dashed"></div>
                            <button class="btn btn-primary btn-block" ms-click="addCCQJ()">添加请假</button>
                            <div class="hr-line-dashed"></div>
                            <h4>类型</h4>
                            <button class="btn   btn-sm " ms-class-1="btn-primary:model.curCCType==''" ms-class-2="btn-white:model.curCCType!=''" vl="" ms-click="LB()" type="button">全部</button>
                            <button class="btn  btn-sm " ms-repeat-item="CCTypeData" ms-class-1="btn-primary:model.curCCType==item.TypeNO" ms-class-2="btn-white:model.curCCType!=item.TypeNO" ms-click="LB()" ms-attr-vl="item.TypeNO" style="margin-right:5px" type="button">{{item.TypeNO}}</button>

                            <div class="hr-line-dashed"></div>
                            <h4 class="tag-title"><a href="APP_CCXJ.html">我的出差请假</a></h4>
                            <h4 class="tag-title" ms-if="model.IsShowTR">他人出差请假</h4>

                            <ul id="tree" ms-if="model.IsShowTR" class="ztree"></ul>

                        </div>
                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>

        <div class="col-sm-9 animated fadeInRight">
            <div class="box" style="margin-bottom:15px;">

                <div class="pull-right mail-search">
                    <div class="input-group">
                        <input type="text" class="form-control input-sm" ms-duplex="SearchContent" name="search" placeholder="输入请假内容查询">
                        <div class="input-group-btn">
                            <button type="submit" class="btn btn-sm btn-primary" ms-click="GetCCDataList()">
                                搜索
                            </button>
                        </div>
                    </div>
                </div>
                <h2>
                    出差请假
                </h2>
                <div class="mail-tools tooltip-demo m-t-md">

                    <div class="btn-group pull-right">
                        <div id="pageDiv" class="text-center"></div>

                    </div>
                    <div class="clearfix"></div>
                </div>

            </div>
            <div class="table-responsive">

                <table class="table table-hover table-mail">
                    <thead>
                        <tr>
                            <th>姓名</th>
                            <th>假别</th>
                            <th>开始时间</th>
                            <th>结束时间</th>
                            <th>天数</th>
                            <th>事由</th>
                            <th>审批状态</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ms-repeat-el="CommonData">
                            <td>{{el.ShenQingRen}}</td>
                            <td>
                                {{el.LeiBie}}
                            </td>
                            <td>{{el.StarTime|date("yyyy-MM-dd")}}</td>
                            <td>{{el.EndTime|date("yyyy-MM-dd")}}</td>
                            <td>{{el.Daycount}}</td>
                            <td>{{el.ZhuYaoShiYou}}</td>
                            <td>
                                {{ComFunJS.getSPStatus(el.StateName,el.ID, el.intProcessStanceid)|html}}
                            </td>
                        </tr>

                    </tbody>
                </table>


            </div>
        </div>
    </div>
    </div>
</body>
</html>
